<?php
declare(strict_types=1);
/**
 * Created by PhpStorm
 * User: Administrator
 * Date: 2023/4/11
 * Time: 09:27:40
 */

namespace App\Controller\Cash\v1;
use App\Controller\AbstractController;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Contract\RequestInterface;
use App\Middleware\CashMiddleware;
use Service\Publics\PublicsService;
use Service\PayService\Payer\Allinpay;


/**
 * @Controller(prefix="/cash/v1/publics")
 * @Middleware(CashMiddleware::class)
 */
class PublicsController extends AbstractController
{
    /**
     * @Inject
     * @var PublicsService
     */
    protected $publicsService;

    /**
     * 获取系统更新版本号
     * @RequestMapping(path="index",methods="post")
     * @return array
     */
    public function index(RequestInterface $request)
    {
        $param = $request->all();
        return $this->publicsService->index($param);
    }
    /**
     * 注册通联终端
     * @RequestMapping(path="allinpayaddtrem",methods="post")
     * @return array
     */
    public function allinpayAddTrem(RequestInterface $request,Allinpay $allinpay) {
        $param = $request->all();
        $mn_sid=(int)$param['mn_sid']??0;
        return $allinpay->addTerm($mn_sid,$param);
    }
    /**
     * 查询通联终端
     * @RequestMapping(path="allinpayquerytrem",methods="post")
     * @return array
     */
    public function allinpayQueryTrem(RequestInterface $request,Allinpay $allinpay) {
        $param = $request->all();
        $mn_sid=(int)$param['mn_sid']??0;
        return $allinpay->queryTerm($mn_sid,$param);
    }
    /**
     * 注销通联终端
     * @RequestMapping(path="allinpaydeltrem",methods="post")
     * @return array
     */
    public function allinpayDelTrem(RequestInterface $request,Allinpay $allinpay) {
        $param = $request->all();
        $mn_sid=(int)$param['mn_sid']??0;
        return $allinpay->delTerm($mn_sid,$param);
    }
}
